package com.example.controller;


import com.example.common.result.Result;
import com.example.entity.vo.CmsmqVo;
import com.example.mapper.CmsmqMapper;
import com.example.service.CmsmqService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author LiangPandeng
 * @since 2024-02-27
 */
@RestController
@RequestMapping("/api/cmsmq")
@Api(tags = "单据性质查询接口")
@Slf4j
public class CmsmqController {

    @Resource
    private CmsmqService cmsmqService;

    @Resource
    private CmsmqMapper cmsmqMapper;

    @ApiOperation("所有单别列表查询 可通过单据性质进行查询")
    @GetMapping("/getBuyListAll")
    public Result<List<CmsmqVo>> getBuyListAll(String mq003){
        List<CmsmqVo> list = cmsmqMapper.selectVoByMq003(mq003);
        return Result.success(list);
    }

    @ApiOperation("采购单单别列表")
    @GetMapping("/getBuyList")
    public Result<List<CmsmqVo>> getBuyList(){
        List<CmsmqVo> list = cmsmqMapper.selectVoByMq003("33");
        return Result.success(list);
    }

    @ApiOperation("客户订单单别列表")
    @GetMapping("/getCustomList")
    public Result<List<CmsmqVo>> getCustomList(){
        List<CmsmqVo> list = cmsmqMapper.selectVoByMq003("22");
        return Result.success(list);
    }

    @ApiOperation("工单单别列表")
    @GetMapping("/getWorkTypeList")
    public Result<List<CmsmqVo>> getWorkTypeList(){
        List<CmsmqVo> list = cmsmqMapper.selectVoByMq003("51");
        list.addAll(cmsmqMapper.selectVoByMq003("52"));
        return Result.success(list);
    }

}
